'use strict';

console.log(`第一题`);
let a = 10;
let b = 5;
let c = (a*b)/2

console.log(c);

var x = 10;
var y = 5;
console.log((x*y)/2);

var x = 10;
var y = 5;
console.log((x*y)/5);

console.log(`第二题`);

let add = 0;
for(let i = 0;i<=100;i++){
    if(i%2===0){
        add += i;
    }
}

console.log(add);

let df = 0;
for(let i =0;i<=100;i++){
    if(i%2===0){
        df +=i;
    }
}
console.log(df);

var aa = 0;
for(var i =0;i<=100;i++){
    if(i%2===0){
        aa +=i;
    }
} 
console.log(aa);


var bb = 0;
for(var i =0;i<=100;i++){
    if(i%2===0){
        bb +=i;
    }
}
console.log(bb);

console.log(`第三题`);

let random = Math.floor((Math.random()*10000)+1);
console.log(random);



console.log(`第四题`);

function level(score){
    if(90<=score && score<=100){
        return '考核等级S，奖励3倍工资';
    }else if(80<=score && score<=89){
        return '考核等级A，奖励2倍工资';
    }else if(70<=score && score<=79){
        return '考核等级B，奖励1倍工资';
    }else if(60<=score && score<=69){
        return '等级C，不奖励，需要继续努力';
    }else if(0<=score && score<=59){
        return '考核等级D，考核较差，需要再观察或者劝退';
    }else{
        return '分数输入有误！！'
    }
}

console.log(level(85));
console.log(level(90));
console.log(level(77));
console.log(level(66));
console.log(level(44));
console.log(level(-1));



console.log(`第五题`);

function func(n){
    if(n>=1){
        let mult =1;
        for(let i =1;i<=n;i++){
            mult *=i;
        }
        return mult;
    }
}

console.log(func(10));

console.log(`第六题`);

function func1(str){
    let strTrim = str.trim();
    console.log(strTrim.length);
}

func1('  ddwad   ')


console.log(`第七题`);

let arr = [10,30,50,22];

let sum = function(arr){
    let arg = 0;
    for(let i =0;i<arr.length;i++){
        arg += arr[i];
    }
    return arg;
}

console.log(sum(arr));

console.log(`第八题`);

let arr1 = [1,4,3,2];

if(arr1.indexOf(3)>-1){
    console.log(arr1.indexOf(3));
}else{
    console.log('不存在');
}


console.log(`第九题`);

let hero ={
    id:1,
    name:"庄周",
    desc:"辅助"
};

hero.sex = "男";

console.log(hero);

console.log(`第十题`);